// JavaScript Document

/****** MENU SUPERIOR ******/ 
var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 

/****** SELECCIONAR TODOS ******/ 
function seleccionar_todo(){
   for (i=0;i<document.lista.elements.length;i++)
      if(document.lista.elements[i].type == "checkbox")
         document.lista.elements[i].checked=1
} 

/****** DESSELECCIONAR TODOS ******/ 
function deseleccionar_todo(){
   for (i=0;i<document.lista.elements.length;i++)
      if(document.lista.elements[i].type == "checkbox")
         document.lista.elements[i].checked=0
} 
/****** ABRIR POPUP ******/ 
 var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
win.focus();}

/****** CONFIRMACION ******/
function elegir() {
if (confirm('Desea borrar el registro ?')) {
alert('El registro se elimino');
} else {
alert('No se elimino nada');
}
}
